﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace Outlook.WorkItems.Extension.Controls
{
    public partial class ErrorForm : Form
    {
        /// <summary>
        /// Ctor
        /// </summary>
        public ErrorForm()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="ex"></param>
        public ErrorForm(Exception ex)
            : this()
        {
            label1.Text = ex.GetType() + " : " + Environment.NewLine + ex.Message;

            textBox1.Text = ex.Message;
            textBox1.Text += "\n StackTrace : ";
            textBox1.Text += ex.StackTrace;

            textBox1.Visible = false;
            Size = new Size(Size.Width, 158);

        }

        /// <summary>
        /// Display details
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Visible = !textBox1.Visible;
            if (textBox1.Visible)
            {
                Size = new Size(Size.Width, 300);
            }
            else
            {
                Size = new Size(Size.Width, 158);
            }

        }
    }
}
